export const computeTime = (originTime: number): string => {
  const time = Number(originTime.toFixed());
  let hours = '';
  if (time / 3600 < 1) {
    hours = '00';
  } else if (time / 3600 >= 10) {
    hours = `${Math.floor(time / 3600)}`;
  } else {
    hours = `0${Math.floor(time / 3600)}`;
  }

  let minutes = '';
  if ((time / 60) % 60 < 1) {
    minutes = '00';
  } else if ((time / 60) % 60 >= 10) {
    minutes = `${Math.floor((time / 60) % 60)}`;
  } else {
    minutes = `0${Math.floor((time / 60) % 60)}`;
  }
  const seconds =
    time % 60 >= 10 ? Math.floor(time % 60) : `0${Math.floor(time % 60)}`;

  if (hours !== '00') {
    return `${hours}:${minutes}:${seconds}`;
  }
  return `00:${minutes}:${seconds}`;
};

export const showHours = (time: number): boolean => time / 3600 >= 1;
